CREATE TABLE [dbo].[TXMVTO_BANC]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_CNTB_EMPR] [dbo].[TD_IN_001_CONT] NOT NULL,
[CO_CNTA_EMPR] [dbo].[TD_VC_020_CNTA] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TXMVTO_BA__NU_AN__162F4418] DEFAULT (datepart(year,getdate())),
[NU_MESE] [dbo].[TD_IN_002_MESE] NOT NULL,
[NU_SECU] [dbo].[TD_IN_001] NOT NULL,
[TI_DOCU] [dbo].[TD_VC_003] NOT NULL,
[NU_DOCU] [dbo].[TD_VC_020] NOT NULL,
[FE_DOCU] [dbo].[TD_DT_001] NOT NULL,
[CO_MONE] [dbo].[TD_VC_003] NOT NULL,
[TI_OPER] [dbo].[TD_VC_003] NOT NULL,
[IM_MVTO_DOCU] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TXMVTO_BA__IM_MV__190BB0C3] DEFAULT ((0)),
[ST_FLAG] [dbo].[TD_VC_001_SINO] NOT NULL CONSTRAINT [DF__TXMVTO_BA__ST_FL__1AF3F935] DEFAULT ('N'),
[NU_ANNO_CONS] [dbo].[TD_IN_004_ANNO] NULL CONSTRAINT [DF__TXMVTO_BA__NU_AN__1CDC41A7] DEFAULT (datepart(year,getdate())),
[NU_MESE_CONS] [dbo].[TD_IN_002_MESE] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TXMVTO_BA__FE_US__1FB8AE52] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TXMVTO_BA__FE_US__20ACD28B] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__CO_CN__153B1FDF] CHECK (([CO_CNTA_EMPR]>='0' AND [CO_CNTA_EMPR]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__IM_MV__19FFD4FC] CHECK (([IM_MVTO_DOCU]>=(0)))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__NU_AN__17236851] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__NU_AN__1DD065E0] CHECK (([NU_ANNO_CONS]>=(0)))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__NU_CN__1446FBA6] CHECK (([NU_CNTB_EMPR]>=(1) AND [NU_CNTB_EMPR]<=(99)))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__NU_ME__18178C8A] CHECK (([NU_MESE]>=(0) AND [NU_MESE]<=(13)))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__NU_ME__1EC48A19] CHECK (([NU_MESE_CONS]>=(0) AND [NU_MESE_CONS]<=(13)))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [CK__TXMVTO_BA__ST_FL__1BE81D6E] CHECK (([ST_FLAG]='N' OR [ST_FLAG]='S'))
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [XPKTXMVTO_BANC] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_CNTB_EMPR], [CO_CNTA_EMPR], [NU_ANNO], [NU_MESE], [NU_SECU]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [TTCNTA_BNCO_A_TXMVTO_BANC] FOREIGN KEY ([CO_EMPR], [CO_CNTA_EMPR]) REFERENCES [dbo].[TTCNTA_BNCO] ([CO_EMPR], [CO_CNTA_EMPR])
GO
ALTER TABLE [dbo].[TXMVTO_BANC] ADD CONSTRAINT [TTCNTB_EMPR_A_TXMVTO_BANC] FOREIGN KEY ([CO_EMPR], [NU_CNTB_EMPR]) REFERENCES [dbo].[TTCNTB_EMPR] ([CO_EMPR], [NU_CNTB_EMPR])
GO
